<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input{
            height: 48px;
        }
    </style>
</head>
<body>
    <div>
        <input type="text"><img src="./睁眼.png">
    </div>
</body>
</html>
<script>
    var inp=document.querySelector('input')
    var img=document.querySelector('img')
    var flag=1
    img.onclick=function(){
        if(flag==1){
            inp.type='password'
            img.src="./闭眼.png"
            flag=0; 
        }else{
            inp.type='text'
            img.src="./睁眼.png"
            flag=1; 
        }  
    }
</script>